# Read files
R1_RT <- read.table("file1.csv", header=TRUE)
R1_No <- read.table("file2.csv", header=TRUE)
R2_RT <- read.table("file3.csv", header=TRUE)
R2_No <- read.table("file4.csv", header=TRUE)
# Get cardinality of Count as values
values1 <- length(R1_RT$Count)
values2 <- length(R1_No$Count)
values3 <- length(R2_RT$Count)
values4 <- length(R2_No$Count)
# The maximum of cycle is the maximum of all Count values
maxCycle <- max(values1, values2, values3, values4)
maxCycle = maxCycle * 1.1
# The maximum of time is defined as 1800s (30m) like the samples
maxTime <- 1800
# The x-axis is a sequence between 0 and the maximum of time
xAxis <- seq(0, maxTime)
# These functions are defined by Rene Dohl and deutsch("entziehen sich meinem Verstaendnis") ;-)
values1Function <- (values1 / maxTime) * xAxis
values2Function <- (values2 / maxTime) * xAxis
values3Function <- (values3 / maxTime) * xAxis
values4Function <- (values4 / maxTime) * xAxis
# Save our graph
png("graph1.png")
# Start a plot with x- and y-axis labels and limitations
plot(0, 0, type="n", xlim=c(0,maxTime), ylim=c(0,maxCycle), xlab="Time", ylab="Cycles", main="Graph 1")
# Draw the 4 lines (functions)
lines(xAxis,values1Function, col="red")
lines(xAxis,values2Function, col="green")
lines(xAxis,values3Function, col="blue")
lines(xAxis,values4Function, col="brown")
# Switch the device off to get a safe instance end
dev.off()
